package com.andy.common.utils

import android.view.View
import android.view.ViewTreeObserver

/**
 * @author Andy
 * @date 2023/8/30
 * @description OnViewGlobalLayoutHeightListener
 */
class OnViewGlobalLayoutHeightListener(private var view: View, private var maxHeight: Int) : ViewTreeObserver.OnGlobalLayoutListener {

    override fun onGlobalLayout() {
        if (view.height > maxHeight) {
            view.layoutParams.height = maxHeight
        }
    }
}